import torch

GPU_AVAILABLE=torch.cuda.is_available()
GPU_COUNT=torch.cuda.device_count()

def duduce_device(name):
    if not GPU_AVAILABLE:
        return torch.device('cpu')
    
    if name=='gpu':
        return torch.device('cuda:0')
    
    else:
        return torch.device('cuda:'+str(int(name)))
    
def default_device():
    return duduce_device('gpu')